package cn.yangliu.springbatch.entity;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * the type of springbatch
 *
 * <p>
 * .
 *
 * @author 杨柳
 * @date 2021-07-13
 */
@Entity
@EqualsAndHashCode
@Table(name = "batch_job_seq")
@IdClass(BatchJobSeq.Pk.class)
public class BatchJobSeq {

    private Long id;
    private String uniqueKey;

    @Embeddable
    @Getter
    @Setter
    public static class Pk implements Serializable {

        private static final long serialVersionUID = 7270485610111244932L;
        private Long id;
        private String uniqueKey;
    }

    public BatchJobSeq(Long id, String uniqueKey) {
        this.id = id;
        this.uniqueKey = uniqueKey;
    }

    public BatchJobSeq() {
    }

    /**
     * instance member witch named id's setter
     * for set field witch named id's value
     *
     * @param id id
     */
    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Id
    @Column(name = "ID", nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    /**
     * instance member witch named uniqueKey‘s getter
     * <p>
     * for get field witch named uniqueKey’s value
     *
     * @return uniqueKey
     */
    @Basic
    @Id
    @Column(name = "UNIQUE_KEY", nullable = false, length = 1)
    public String getUniqueKey() {
        return uniqueKey;
    }

    /**
     * instance member witch named uniqueKey's setter
     * for set field witch named uniqueKey's value
     *
     * @param uniqueKey uniqueKey
     */
    public void setUniqueKey(String uniqueKey) {
        this.uniqueKey = uniqueKey;
    }

}
